﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<UI.Web.MVC.Models.RegisterModel>" %>

<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
    注册
</asp:Content>

<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" src="../../Scripts/jquery-1.6.2.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.js"></script>
    <script type="text/javascript" src="../../Scripts/MicrosoftMvcValidation.js"></script>
    <script language="javascript" type="text/javascript">
        function Success(data) {
            alert(data);
        }
        function Failure() {
            alert("失败！");
        }
    </script>
    <div id="AcctInfo">
        <h2>注册新用户</h2>
        <p>
            填写下面的信息。
        </p>
        <p>
            密码长度最少为 <%: ViewData["PasswordLength"] %> 个字符.
        </p>

        <%  using (Ajax.BeginForm("RegisterAjax", "Account", new AjaxOptions
{
    //UpdateTargetId = "AcctInfo",
    HttpMethod = "Post",
    OnSuccess = "Success",
    OnFailure = "Failure"
}))
            { %>
        <%: Html.ValidationSummary(true, "账户创建失败，请更正相应的错误之后重试。") %>
        <div class="Accout">
            <fieldset>
                <legend>账户信息</legend>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.UserName) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(m => m.UserName) %>
                    <%: Html.ValidationMessageFor(m => m.UserName) %>
                </div>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.Email) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(m => m.Email) %>
                    <%: Html.ValidationMessageFor(m => m.Email) %>
                </div>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.Password) %>
                </div>
                <div class="editor-field">
                    <%: Html.PasswordFor(m => m.Password) %>
                    <%: Html.ValidationMessageFor(m => m.Password) %>
                </div>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.ConfirmPassword) %>
                </div>
                <div class="editor-field">
                    <%: Html.PasswordFor(m => m.ConfirmPassword) %>
                    <%: Html.ValidationMessageFor(m => m.ConfirmPassword) %>
                </div>

                <p>
                    <input type="submit" value="注册" />
                </p>
            </fieldset>
        </div>
        <% } %>
    </div>
</asp:Content>
